<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <li v-for="(name,index) in students" :key="index">
            {{index+1}}.{{name}}
        </li>
    </div>
    <script src="../assets/vue2.js"></script>
    <script>
        function getStudents() {
            return new Promise(res => {
                setTimeout(() => {
                    res(['小李', '小明', '王二']);
                }, 2000);
            })
        }
        const app = new Vue({
            el: '#app',
            data() {
                return {
                    students: []
                }
            },
            // 【常用】组件实例已创建，尚未挂载，dom不存在
            async created() {
                this.students = await getStudents();
            },
        });
    </script>
</body>

</html>